import Vue from "vue";
import App from "./App";
import utils from "@/utils/index.js";
import Empty from "@/components/empty";
import uView from "uview-ui";
import store from "./store";
import print from '@/utils/print'
const NODE_ENV = process.env.NODE_ENV;
if (NODE_ENV === "development") {
	// console.log = () => {}
} else{
	console.log = () => {}
}
Vue.use(print)
// import ReplceInfo from "./utils/repleceInfo.js";
Vue.use(uView);

Vue.prototype.resBaseUrl = utils.resBaseUrl;
Vue.prototype.checkUser = utils.checkUser;
Vue.prototype.skip = utils.skip;
Vue.prototype.$store = store;
// Vue.prototype.ReplceInfo = ReplceInfo;

Vue.prototype.$api = {}; //定义api对象
uni.$u.setConfig({
	// 修改$u.config对象的属性
	config: {
		unit: "rpx",
	},
});

Vue.config.productionTip = false;
App.mpType = "app";

Vue.component("Empty", Empty);
const app = new Vue({
	...App,
	store,
});

// 引入请求函数
require("./config/request.js")(app);
import api from "@/config/api.js";
Vue.use(api, app);


Vue.filter("unifyNumber", (num) => {
	if (!+num) {
		return 0
	} else {
		let handleNum = parseFloat(num)
		let isToFixed = handleNum.toString().includes('.') && handleNum.toString().split('.')[1].length > 2
		if (isToFixed) {
			return handleNum.toFixed(2)
		} else {
			return handleNum
		}
	}
})
app.$mount();